package com.parenting.feigncontroller;

import com.parenting.entities.ParentingShopDO;
import com.parenting.feign.controller.IFeignPlatformShopController;
import com.parenting.feign.entities.ShopLowerDTO;
import com.parenting.service.ParentingShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@Slf4j
public class FeignPlatformShopController implements IFeignPlatformShopController {
    @Autowired
    private ParentingShopService parentingShopService;
    @Override
    public List<ShopLowerDTO> getAllShopLower() {
        List<ShopLowerDTO> lowerDTOS=new ArrayList<>();
        List<ParentingShopDO> list = parentingShopService.getBaseMapper().selectList(null);
        for (ParentingShopDO shop:list) {
            ShopLowerDTO lower=new ShopLowerDTO();
            lower.setShopId(shop.getId());
            lower.setShopName(shop.getShopName());
            lowerDTOS.add(lower);
        }
        return lowerDTOS;
    }
}
